package com.devsoft.foodflip;

import java.util.ArrayList;

public class Unlockable {
	private String description;
	private boolean unlock;
	private int counter;
	private int goal;
	
	public Unlockable(){}
	
	public Unlockable(String text, int max){
		this.description = text;
		this.unlock = false;
		this.counter = 0;
		this.goal = max;
	}
	
	public void setCounter(int val){
		this.counter = val;
	}
	
	public void increaseCounter(){
		this.counter++;
	}
	
	public String getDescription(){
		return this.description;
	}
	
	public boolean getState(){
		return this.unlock;
	}
	
	public ArrayList <Unlockable> updateAchievements(ArrayList <Unlockable> list){
		for(int i=0;i<list.size();i++){
			if(list.get(i).counter >= list.get(i).goal){
				list.get(i).unlock = true;
			}
		}
		return list;
	}
	
	public void saveAchievementList(){
		
	}
	
	public void loadAchievementList(){
		
	}
	
	public ArrayList <Unlockable> generateAchievements(){
		Unlockable classic_5 = new Unlockable("Play 5 games in Classic Mode",5);
		Unlockable classic_10 = new Unlockable("Play 10 games in Classic Mode",10);
		Unlockable classic_20 = new Unlockable("Play 20 games in Classic Mode",20);
		Unlockable classic_50 = new Unlockable("Score 50 points in Classic Mode",50);
		Unlockable classic_100 = new Unlockable("Score 100 points in Classic Mode",100);
		Unlockable classic_200 = new Unlockable("Score 200 points in Classic Mode",200);
		Unlockable arcade_5 = new Unlockable("Play 5 games in Arcade Mode",5);
		Unlockable arcade_10 = new Unlockable("Play 10 games in Arcade Mode",10);
		Unlockable arcade_20 = new Unlockable("Play 20 games in Arcade Mode",20);
		Unlockable arcade_50 = new Unlockable("Score 50 points in Arcade Mode",50);
		Unlockable arcade_100 = new Unlockable("Score 100 points in Arcade Mode",100);
		Unlockable arcade_200 = new Unlockable("Score 200 points in Arcade Mode",200);
		Unlockable game_50 = new Unlockable("Play 50 games",50);
		Unlockable game_100 = new Unlockable("Play 100 games",100);
		Unlockable game_200 = new Unlockable("Play 200 games",200);
		Unlockable powerup_5 = new Unlockable("Collect 5 power-ups",5);
		Unlockable powerup_10 = new Unlockable("Collect 10 power-ups",10);
		Unlockable powerup_20 = new Unlockable("Collect 20 power-ups",20);
		Unlockable food_50 = new Unlockable("Cook 50 food items",50);
		Unlockable food_100 = new Unlockable("Cook 100 food items",100);
		Unlockable food_200 = new Unlockable("Cook 200 food items",200);
		Unlockable food_500 = new Unlockable("Flip 500 food items",500);
		Unlockable food_1000 = new Unlockable("Flip 1,000 food items",1000);
		Unlockable food_2000 = new Unlockable("Flip 2,000 food items",2000);
		
		ArrayList <Unlockable> achievementsList = new ArrayList <Unlockable>();
		
		achievementsList.add(classic_5);
		achievementsList.add(classic_10);
		achievementsList.add(classic_20);
		achievementsList.add(classic_50);
		achievementsList.add(classic_100);
		achievementsList.add(classic_200);
		achievementsList.add(arcade_5);
		achievementsList.add(arcade_10);
		achievementsList.add(arcade_20);
		achievementsList.add(arcade_50);
		achievementsList.add(arcade_100);
		achievementsList.add(arcade_200);
		achievementsList.add(game_50);
		achievementsList.add(game_100);
		achievementsList.add(game_200);
		achievementsList.add(powerup_5);
		achievementsList.add(powerup_10);
		achievementsList.add(powerup_20);
		achievementsList.add(food_50);
		achievementsList.add(food_100);
		achievementsList.add(food_200);
		achievementsList.add(food_500);
		achievementsList.add(food_1000);
		achievementsList.add(food_2000);
		
		return achievementsList;
	}
}
